﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DoubleClick : MonoBehaviour
{
    int Count = 0;
    Vector3 oldPoint = Vector3.zero;
    Vector3 thePoint;
    void Update()
    {
        //SetRayFromCamera();
        SetRayFromCamera(Input.mousePosition);
    }

    private void SetRayFromCamera(Vector3 point)
    {
        Ray ray = Camera.main.ScreenPointToRay(point);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
        {
            Debug.Log(point);
        }
        if (Vector3.Distance(oldPoint, point) < 0.5f)
        {
            Debug.Log("点击到一个点上");
            thePoint = point;
        }
        else
        {
            Debug.Log("新的点生成");
        }
        oldPoint = point;
        Debug.Log(Count);
    }
}
